<%@ page language="java" import="java.util.*"  contentType="text/html; charset=UTF-8"%>
<%@ page import="crm.util.ParamUtil" %>
<%@ page import="crm.model.Schedule" %>
<%@ page import="crm.control.ScheduleControl"%>
<%@ page import="crm.control.EmployeesControl" %>
<%@page import="java.util.*"%>
<%@page import="crm.control.CustomerControl"%>
<%@page import="crm.control.EmployeesControl"%>
<%@page import="crm.model.Employees"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>天成科技CRM管理系统</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="../../../resources/css/reset.css" type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="../../../resources/css/style.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="../../../resources/css/invalid.css" type="text/css" media="screen" />
<!--                       Javascripts                       -->
<!-- jQuery -->
<script type="text/javascript" src="../../../resources/scripts/jquery-1.3.2.min.js"></script>
<!-- jQuery Configuration -->
<script type="text/javascript" src="../../../resources/scripts/simpla.jquery.configuration.js"></script>
 <script type="text/javascript" src="../../../resources/js/WebCalendar.js"></script>
<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="../../../resources/scripts/facebox.js"></script>
<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="../../../resources/scripts/jquery.wysiwyg.js"></script>
<!-- jQuery Datepicker Plugin -->
<script type="text/javascript" src="../../../resources/scripts/jquery.datePicker.js"></script>
<script type="text/javascript" src="../../../resources/scripts/jquery.date.js"></script>
<script type="text/javascript" src="../../../resources/js/reinitIframe.js"></script>
<script type='text/javascript'>
window.onload=function(){
	//var num=document.getElementById('num').value;
	setInterval(function(){
		new ReinitIframe('iadd');
		new ReinitIframe('iinformation');
		/*for(var i=1;i<=num;i++){
			var check = 'icheck' + i;
			var alter = 'ialert' + i;
			new ReinitIframe(check);
			new ReinitIframe(alter);
		}*/
	},200);
	new SortTr('tbcontent','predicttime','predictbtn');
	new SrotStage('tbcontent','money','money');
	new SrotStage('tbcontent','stage','stage');
	/*$('#flag').val('1');
	setInterval(function(){
			$.ajax({
				url: "../../control/statistics/alert.jsp",
				cache: false,
				contentType: "application/x-www-form-urlencoded; charset=UTF-8",
				dataType: "text",
				success:function(data){
					data = data.replace(/\s+/g,'');				
					var reg = /^true/gi;	
					var arr = [];
					if($('#flag').val() == 1){
						if(reg.test(data+'')){
							$(".promot").show();
							data = data.replace(reg,'');
							arr = data.split(/\?/);
							var ect='';
							if(arr.length>10){
								arr = arr.slice(0,10);
								ect = '等'
							}
							var restring = arr.join("，");
							restring = restring.replace(/\，$/,'');
							restring += ect;
							$('.reply').html(restring);
						} else{
							$('.promot').hide();
						}
					} else{
						return;
					}				
					
				}
			})
	},5000);
	$('#close').click(function(){
		$('#flag').val('0');
		$('.promot').hide();
	})*/
}


</script>
<style type="text/css">
.hide{
    position: absolute;
    zoom: 0.001;
    -moz-transform: scale(0);
    -webkit-transform: scale(0);
    -o-transform: scale(0);
    transform: scale(0);
}
</style>
</head> 
  <body>
  <%
  	 request.setCharacterEncoding("utf-8");
      Employees cu = (Employees)session.getAttribute("user");
   %>
  <div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="sidebar">
    <div id="sidebar-wrapper">
      <!-- Sidebar with logo and menu -->
      <h1 id="sidebar-title"><a href="#">天成科技CRM管理系统</a></h1>
      <!-- Logo (221px wide) -->
      <a href="#"><img id="logo" src="../../../resources/css/slice/notice.png" alt="Simpla Admin logo" /></a>
      <!-- Sidebar Profile links -->
      <div id="profile-links"> <a href="#"><%=EmployeesControl.getEmployeesName(cu.getId())%>,您好！</a> <br />
        <br />
        <a href="#information" rel='modal' >修改个人信息</a> | <a href="../../login/logout.jsp" title="Sign Out">注销</a> </div>
      <ul id="main-nav">
        <!-- Accordion Menu -->
        <li> <a href="#" class="nav-top-item">公司页面 </a>
          <ul>
	          <li><a href='../company/material/material_download.jsp'>资料 </a></li>
	          <li><a href='../company/notice/notice.jsp'>公告</a></li>
	          <li><a href='../company/salearea/salearea.jsp'>销售区域</a></li>
	          <li><a href='../company/saleskill/saleskill.jsp'>销售技巧</a></li>
	          <li><a href='../company/saletarget/saletarget.jsp'>销售目标</a></li>
          </ul>
         </li>
        <li> <a href="../recepit/show_all_recepits.jsp" class="nav-top-item no-submenu">
          <!-- Add the class "current" to current menu item -->
           我的跟单</a>
        
        </li>
        <li> <a href="../offer/show_all_offers.jsp" class="nav-top-item no-submenu">报<span class='letter'>价</span></a>      
        </li>
        <li> <a href="../bargain/show_all_bargains.jsp" class="nav-top-item no-submenu">合<span class='letter'>同</span></a>
        </li>
        <li> <a href="#" class="nav-top-item current">日<span class='letter'>程</span></a>
        	<ul>
	        	<li><a class='current' href='../schedule/schedule.jsp'>日程管理</a></li>
	        	<li><a href='../schedule/all_sum.jsp'>周总结</a></li>
	        	<li><a href='../schedule/all_plan.jsp'>周计划</a></li>
        	</ul>
        </li>
        <li> <a href="../customer/customer.jsp" class="nav-top-item no-submenu">我的客户</a>
        <%
            if(cu.getPosition()!=1){
            	%>
            	<li> <a href="#" class="nav-top-item">统<span class='letter'>计</span></a>
		          <ul>
		            <li><a href="../../control/statistics/company_statistics.jsp">公司统计</a></li>
		            <li><a href="../../control/statistics/employees_statistics.jsp">员工统计</a></li>
		          </ul>
		        </li>
            	<li><a href="../employees/employees.jsp" class="nav-top-item no-submenu">员工管理</a></li>
            	<%
            }
        %>
        </li>
      </ul>
    </div>
  </div>
  <div id="main-content">
  <img src='../../../resources/css/slice/t.png'/>
  	  <form>
	 <div class="content-box-header">
	 <h3 style="cursor: s-resize;">所有日程</h3>
	 </div>
	 <table border='1'>
	  		<thead>
	  			<tr>
	  				<th>创建人姓名</th>
	  				<th>创建时间</th>
	  				<th>主题</th>
	  				<th>内容</th>
	  				<th>状态</th>
	  				<th>完成时间</th>
	  				<th>关联客户姓名</th>
	  				<th>状态</th>
	  				<th>操作</th>
	  			</tr>
	  		</thead>
	  		<tbody>
	  			<%
					request.setCharacterEncoding("UTF-8");
					int pages = ParamUtil.getInt(request,"pages",0);
					int rowsPerpage = ParamUtil.getInt(request,"pageSize",10);
					Schedule schedule = new Schedule();
					ScheduleControl sc = new ScheduleControl();
					List <Schedule> list = new ArrayList<Schedule>();
					list = (List)sc.getSchedule(pages,rowsPerpage,"create_time");
					for(int i=0;i<list.size();i++){
						schedule = list.get(i);
						System.out.println(schedule.getCreater());
					 %>
					 <tr>
					<td><%=EmployeesControl.getEmployeesName(schedule.getCreater()) %></td>
					<td><%=schedule.getCreate_time() %></td>
					<td><%=schedule.getTheme()%></td>
					<td><%=schedule.getContent() %></td>
					<td><%=schedule.getState() %></td>
					<td><%=schedule.getFinish_time() %></td>
					<td><%=schedule.getRelated_customer() %></td>
					<td><input type="button"  <%if(schedule.getState().equals("未完成")){%> value="完成日程" onClick="window.location.href='schedule_finish.jsp?id=<%=schedule.getId()%>'"<%}else{ %> value="已完成"<%} %>/></td>
					<td><a href="schedule_delete.jsp?id=<%=schedule.getId()%>" onclick="return confirm('确认删除？')">删除</a></td>
					 </tr>
					 <%} %>
	  		</tbody>
	  	</table>
	  	<br/>
	  	<a class='button' href='#add' rel='modal' >添加日程 </a>
<div class='hide' >
	<div id='information'>
		<iframe id='iinformation' style='width:368px; overflow:hidden;' scrolling='no' frameborder='0' src='../employees/employees_update.jsp'></iframe>
	</div>
</div>
<div class='hide' >
	<div id='add'>
		<iframe id='iadd' style='width:368px; overflow:hidden;' scrolling='no' frameborder='0' src='schedule_add.jsp'></iframe>
	</div>
</div>
</form>
 </div>
 </div>
  </body>
</html>
